import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChangeRecordVO, ChangeRecordForm, ChangeRecordQuery } from '@/api/system/changeRecord/types';

/**
 * 查询设备替换列表
 * @param query
 * @returns {*}
 */

export const listChangeRecord = (query?: ChangeRecordQuery): AxiosPromise<ChangeRecordVO[]> => {
  return request({
    url: '/system/changeRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备替换详细
 * @param id
 */
export const getChangeRecord = (id: string | number): AxiosPromise<ChangeRecordVO> => {
  return request({
    url: '/system/changeRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增设备替换
 * @param data
 */
export const addChangeRecord = (data: ChangeRecordForm) => {
  return request({
    url: '/system/changeRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备替换
 * @param data
 */
export const updateChangeRecord = (data: ChangeRecordForm) => {
  return request({
    url: '/system/changeRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备替换
 * @param id
 */
export const delChangeRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/changeRecord/' + id,
    method: 'delete'
  });
};
